package org.mct.mes.mapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.mct.mes.entity.MesRawData2;

import java.time.Instant;
import java.time.ZonedDateTime;
import java.util.List;

@Mapper
public interface MesRawData2Mapper {
    @Select({"<script>",
            "SELECT * FROM mes_raw_data2",
            "WHERE 1=1",
            "<if test='device_code != null and device_code != \"\"'> AND device_code like CONCAT('%', #{device_code}, '%')</if>",
            "<if test='queryTimeStart != null or queryTimeEnd != null'> AND enter_time between #{queryTimeStart} and #{queryTimeEnd}</if>",
            "</script>"})
    List<MesRawData2> query10(String device_code,Instant queryTimeStart, Instant queryTimeEnd);


    @Insert("insert into mes_raw_data2 values(#{id},#{device_code},#{enter_time},#{guid},#{json_content},#{json_response},#{port_url},#{post_time},#{respon_time})")
    int addOne(MesRawData2 mesRawData2);
}
